<template>
	<view class="content">
		<!-- 公共组件-每个页面必须引入 -->
		<!-- <public-module></public-module> -->
		<course-list :list="list" :orderNum="orderNum" v-if="list.length != 0"></course-list>
		<u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" v-else></u-empty>
		<fTabbar></fTabbar>
	</view>
</template>

<script>
import fTabbar from '@/components/module/f-tabbar/f-tabbar';
import courseList from './module/course-list.vue';
export default {
	components: {
		fTabbar,
		courseList
	},
	data() {
		return {
			list: [],
			height: '',
			defaultIndex: [0, 0, 0],
			params: {},
			orderNum: ''
		};
	},
	//第一次加载
	onLoad(e) {
		// 需要固定swiper的高度
		// #ifndef MP-ALIPAY
		this.height = uni.getSystemInfoSync().windowHeight - 108 + 'px';
		// #endif
		// #ifdef MP-ALIPAY
		this.height = uni.getSystemInfoSync().windowHeight - uni.getSystemInfoSync().statusBarHeight - uni.getSystemInfoSync().titleBarHeight - uni.upx2px(88) - 46 + 'px';
		// #endif

		if (e.orderNum) {
			this.orderNum = e.orderNum;
			this.getList(e.orderNum);
		} else {
			uni.showToast({
				icon: 'none',
				title: '请检查订单号'
			});
		}
	},
	methods: {
		getList(orderNum) {
			uni.$u.http
				.post(
					'/user/info/courseListByOrder',
					{
						orderNum
					},
					{
						custom: {
							load: false,
							auth: true
						}
					}
				)
				.then((res) => {
					this.list = res;
					// console.log("res:", res);
				});
		},
		dateChange(d) {
			uni.showToast({
				icon: 'none',
				title: d
			});
		}
	}
};
</script>

<style>
.page {
	background-color: #f2f2f2;
}
</style>
